import { defineStore } from 'pinia'
import type { RouteRecordRaw } from 'vue-router'
export interface UserState {
  token : string
}
const useUserStore = defineStore({
  id: 'user',
  state: () : UserState => ({
    token: getToken() || '',
    // 用户信息
    userInfo: {},
    // 路由
    routes: [],
    // 权限
    perms: []
  }),
  getters: {},
  actions: {
    resetState() {
      this.token = ''
    },
    logout() {
      return new Promise((resolve, reject) => {
        this.token = '';
        resolve(this.token)
        reject(this.token)
      })
    },
    
  }
})

export default useUserStore